<script type="text/javascript">
function ValidateForm(frm)
{
	var page_id = document.getElementById('id').value;

	
	if(page_id == "") {
		document.getElementById('process').value = 'add';
	}
	else {
		document.getElementById('process').value = 'edit';
	}
	document.frm.submit();

	return false;
}
</script>
<?php
$path = "../uploads/banners/";
$query = mysql_query("select `id`, `ad_name`, `upload_file`, `file_name`,`url`,`source`,`active_status` from banner_ads where id='".$_REQUEST['_d']."'") or die(mysql_error());

$res = mysql_fetch_array($query);

if($res["active_status"] == 1) {
	$active_status = "checked";
}
else {
	$deactive_status = "checked";
}

if($res['upload_file'] != "") {
	$view_image = '<a href="'.$path.$res['upload_file'].'"<img src="images/view_image_big.png"/></a>';
}
?>
<table border="0" width="100%" align="center">
<tr>
	<td width="46%" align="left"><span style="color:#1B78B7; font-size:14px; font-weight:bold">
    Add Banners</span>&nbsp; 
	<!--<input type="button" name="addnew" value="Add New" onclick="return show();" />-->
	</td>
	<td width="40%" align="right" class="font12">
    <a href="index.php?tc=banner_ads" class="font12">Manage Banners</a></td>
</tr>
<tr>
	<td background="images/topline.gif" colspan="3" height="11"></td>
</tr>    
</table>
<form name="formPage" method="post" action="action.php" onSubmit="return ValidateForm(this);" enctype="multipart/form-data">
<table width="99%" align="center" border="0"  class="list">
<tr>
	<td align="right" width="250">Banner Name*</td>
    <td align="left"><input class="text" name="banner_name"  id="banner_name" type="text" value="<?php echo $res['ad_name'];?>"/></td>
</tr>
<!--
<tr>
	<td align="right" width="250">Upload SWF*</td>
    <td align="left">
    <input type="file" name="file_name" id="file_name" value="" />&nbsp;&nbsp;
    <span style="color:#ff0000;font-weight:bold;font-size:10px;" >(.swf files only)<?php echo $view_image;?></span>
    </td>
</tr>-->
<tr>
	<td align="right" width="250">Source </td>
    <td align="left">
    <textarea name="source"  id="source" style="width:600; height:300; "><?php echo $res['source'];?></textarea>
  </td>
</tr>
<!--<tr>
	<td align="right" width="250">Url </td>
    <td align="left">
   <input class="text" name="url"  id="url" type="text" value="<?php echo $res['url'];?>"/>&nbsp;&nbsp;

    </td>
</tr>-->
<tr>
  <td align="right" width="150">Status :</td>
  <td align="left">
  <input name="authorised" type="radio"  value=1 <?php echo $active_status;?> />&nbsp;Active&nbsp;&nbsp;
  <input name="authorised" type="radio" value=0 <?php echo $deactive_status;?>/>&nbsp;Deactive</td>
</tr>
<tr>
	<td align="right" width="150"></td>
    <td align="left">
    <input name="id" id="id" type="hidden" value="<?php echo $res['id'];?>"/>
     <input name="module" id="module" type="hidden" value="banner_ads"/>
    <input name="process" id="process" type="hidden" value=""/>
    <input type="submit" value="Submit" name="save_gadgettech">&nbsp;<input type="reset" name="reset" value="Clear" /></td>
</tr>
</table>
</form>